<?php
    $data = $dbClass->slc_db_where("dt_pages", "p_id", "1");
    $row = mysql_fetch_array($data);
?>

<table cellpadding="0" cellspacing="0" width="100%" border="0">
    <tr>
        <td id="coloana_stanga_root" valign="top">
            <!-- coloana stanga /////////////////////////////////////// -->
            <!-- meniu stanga ///////////////////////////////////////// -->
            <?php include DIR_MODULES . 'menu/menu_main_home.php'; ?>
            <!-- end meniu stanga ///////////////////////////////////// -->
            <?php 
            $cStanga = mysql_query("select * from dt_mod_visible
                where z_id = '1'
                and visible = '1'
                and p_id = '1'
                order by `order`");
            include DIR_MODULES . 'coloane_module/coloana_stanga.php';
            ?>
            <!-- end coloana stanga /////////////////////////////////// -->
        </td>
        <td class="coloana_separator" valign="top">&nbsp;</td>
        <td  id="coloana_dreapta_root" valign="top">
        <!-- mijloc si dreapta //////////////////////////////////// -->
        <!-- galerie media //////////////////////////////////////// -->
        <?php include DIR_MODULES . 'galerie_header/index.php';?>
        <!-- end galerie media //////////////////////////////////// -->
        <table cellpadding="0" cellspacing="0" width="100%" border="0">
            <tr>
                <td id="content" valign="top">
                <!-- content mijloc /////////////////////////////////////// -->
                    <div class="mijloc_root">
                        <?php
                            $settings = $dbClass->slc_db_all("dt_settings");
                            $settRow = mysql_fetch_array($settings);
                            $data = mysql_query("select * from dt_offers where o_active = '1' order by `o_id` desc limit 0,".$settRow['s_nr_items_fp']);

                            $i = 0;
                            while ($row = mysql_fetch_array($data)){
                                $imgs = $offersClass->picViewForOffer($row['o_id']);
                                $img = mysql_fetch_array($imgs);
                                echo '<div class="mijloc_modul_corporate">';
                                echo '<table class="mijloc_modul_corporate" cellpadding="0" cellspacing="0" border="0" width="100%">';
                                echo '<tr>';
                                echo '<td valign="top">';

                                $categories = $dbClass->slc_db_where("dt_categories", "c_id", $row['c_id']);
                                $ctgRow = mysql_fetch_array($categories);

                                echo '<div class="corporate_pretitlu"><a href="categories/'.$ctgRow['c_id'].'/'.cleanitup($ctgRow['c_title']).'.html">'.$ctgRow['c_title'].'</a></div>';
                                if($i % 2){
                                    echo '<div class="leisure_titlu"><a class="link_titlu_vaca" style="color:#777777; font-weight:500;" href="offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.$row['o_title'].'</a>';
                                    echo '&nbsp;<a href="offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.$row['o_label'].'</a>';
                                } else {
                                    echo '<div class="corporate_titlu"><a class="link_titlu_vaca" style="color:#777777; font-weight:500;" href="offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.$row['o_title'].'</a>';
                                    echo '&nbsp;<a href="offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.$row['o_label'].'</a>';
                                }
                                echo '</div>';
                                echo '<div class="corporate_content">';
                                echo '<a class="link_vaca" href="offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.limitclear($row['o_small_desc'], 160).'...</a>';
                                echo '</div>';
                                if ($row['o_price'] != '')
                                    echo '<div class="corporate_postcontent">De la <b>'.$row['o_price'].'</b> '.$row['o_price_type'].'</div>';
                                echo '</td>';

                                $photos = mysql_query("select * from dt_offers_photos where o_id = '".$row['o_id']."' order by `oImg_id` desc limit 1");
                                $photoRow = mysql_fetch_array($photos);

                                if ($photoRow['oImg_file'] != ''){
                                    echo '<td align="right" valign="bottom" style="padding-bottom:10px;">';
                                    echo '<a href="offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">';
                                    echo '<img class="mijloc_pic" src="uploads/offers/img/'.cleanitup($row['o_title']).'/thumbs/thumb_'.$photoRow['oImg_file'].'" width="160" height="120">';
                                    echo '</a>';
                                    echo '</td>';
                                }
                                echo '</tr>';
                                echo '</table>';
                                echo '<div class="mijloc_hr">&nbsp;</div>';
                                echo '</div>';

                                $i++;
                            }
                        ?>
                    </div>
                <!-- end content mijloc /////////////////////////////////// -->
                </td>
                <td class="coloana_separator" valign="top">&nbsp;</td>
                <?php
                    $cDreapta = mysql_query("select * from dt_mod_visible
                                    where z_id = '2'
                                    and visible = '1'
                                    and p_id = '1'
                                    order by `order`");
                    //daca nu exista nici un rezultat atunci ascunde coloana
                    if (mysql_num_rows($cDreapta)>0){
                ?>
                <td id="content_dreapta" valign="top">
                    <!-- content dreapta ////////////////////////////////////// -->
                    <?php include DIR_MODULES . 'coloane_module/coloana_dreapta.php'; ?>
                    <!-- end content dreapta ////////////////////////////////// -->
                </td>
                <?php }?>
            </tr>
        </table>
        <!-- end mijloc si dreapta //////////////////////////////// -->
        </td>
    </tr>
</table>